/**
 * @file main.cpp
 * @author ikun (2732608951@QQ.com)
 * @brief Used for DoubleLinkedList's testment
 * @version 0.1
 * @date 2022-10-04
 * 
 * @copyright Copyright (c) 2022
 * 
 */
#include"DoubleLinkedList.h"
#include<iostream>
using namespace std;

template<typename DT>
/**
 * @brief find a specific data in the list
 * Return the finded iterator when successful
 * Return nullptr and output warning when failed
 * 
 * @param _list 
 * @param _val 
 * @return DoubleLinkedList<DT>::iterator 
 */
typename DoubleLinkedList<DT>::iterator DoubleLinkedList<DT>::
find(DoubleLinkedList<DT>& _list,const DT& _val)
{
    for(Node *p=_list.head->next;p!=tail;p=p->next)
        {
            if(p->data==_val)
                return p;
        }
        cout<< "Not Find!" <<endl;
        return nullptr;
}

int main()
{
    DoubleLinkedList<int> L;
    for(int i=1;i<=5;i++)
    {
        L.push_back(i);
    }
    L.printList();
    DoubleLinkedList<int>::iterator iter;
    iter=L.find(L,3);
    L.erase(iter);
    L.printList();
    iter=L.find(L,3);
    

}
